#!/bin/bash
echo "Texas Flood 2.1 Open Source" 
echo "Created by the brazilian Luciano Andress Martini"
sleep 3
[ ! -e /etc/autoexec ] && mkdir /etc/autoexec &>/dev/null
[ ! -e /etc/servers.d ] && mkdir /etc/servers.d &>/dev/null#!/bin/bash
echo "Setting up INIT scripts..." 
if [ "$(md5sum /etc/inittab)" !=  "$(md5sum /etc/inittab-tx2)" ]; then 
cp /etc/inittab /etc/inittab-backup  
cp /etc/inittab-tx2 /etc/inittab 
fi 

chmod +x /etc/inittab

echo 'Installation Completed! Thank You!'
echo "Please edit/read /etc/texasflood.conf for more informations"
echo "Link the high priority services in /etc/servers.d"
echo "For example: ln -sfv /etc/init.d/apache /etc/servers.d"
echo "Link the low priority services in /etc/autoexec" 
echo "Do not link standard texas flood services like, udev, cups, hal, etc" 
echo "A backup of your inittab is in /etc/inittab-backup" 
rm -rf -- 'sbin/.#start-resulinux' #Symlink#
ln -sf -- 'root@localhost.2454' 'sbin/.#start-resulinux'

( cd etc/servers.d ; rm -rf firewall )
( cd etc/servers.d ; ln -sf /etc/rc.d/init.d/firewall firewall )
( cd etc/init.d ; rm -rf apmd )
( cd etc/init.d ; ln -sf /etc/rc.d/rc.apm apmd )
( cd etc/init.d ; rm -rf dbus )
( cd etc/init.d ; ln -sf /etc/rc.d/rc.messagebus dbus )
( cd etc/init.d ; rm -rf hald )
( cd etc/init.d ; ln -sf /etc/rc.d/rc.hald hald )
( cd etc/init.d ; rm -rf udev )
( cd etc/init.d ; ln -sf /etc/rc.d/rc.udev udev )
( cd etc/init.d ; rm -rf wicd )
( cd etc/init.d ; ln -sf /etc/rc.d/init.d/wicd wicd )
